// Function.prototype.myBind = function (){
//   let args = Array.prototype.slice.call(arguments)
//   const target = args.shift()
//   let _self = this
//   return function () {
//     var args_1 = Array.prototype.slice.call(arguments)
//     return _self.apply(target,args.concat(args_1))
//   }
// }

// function toSay (b,c) {
//   console.log('-----------------------')
//   console.log(this.a)
//   console.log(b)
//   console.log(c)
// }
// var obj = {a:123}
// let toSayBind = toSay.myBind(obj,'9')
// toSayBind('10')


Function.prototype.myBind = function(){
  let args = Array.from(arguments)
  console.log(args)
  const target = args.shift()
  let self = this
  return function () {
    let args1 = Array.from(arguments)
    self.apply(target,args.concat(args1))
  }
}

function fn1 (name,age) {
  this.name = name
  age && (this.age = age)
}

var obj = {}

var fn2 = fn1.myBind(obj,'lujb1')
fn2(23)
console.log(obj)